package com.bos.dao.impl;

import com.bos.dao.PeriodeDAO;
import com.bos.domain.Periode;
import com.bos.domain.Tahun;
import org.springframework.dao.DataAccessException;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * Created by IntelliJ IDEA.
 * User: Latief
 * Date: 3/15/11
 * Time: 9:35 PM
 * To change this template use File | Settings | File Templates.
 */
@Repository
public class PeriodeDAOImpl extends GenericDAOImpl<Periode> implements PeriodeDAO {

    public PeriodeDAOImpl() {
        super(Periode.class);
    }

    public List<Periode> getByTahun(Tahun tahun) throws DataAccessException {
//        entityManager.clear();
        return entityManager.createQuery("select obj from " + type.getName() + " obj where obj.tahun = :tahun")
                .setParameter("tahun", tahun)
                .getResultList();
    }

}
